﻿@model SuperiorModel.ProductModel

@{
    ViewBag.Title = "修改商品";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var menuList = ViewBag.MenuList;
    var ships = ViewBag.Ships;
}
<input type="hidden" id="mapRotute" map="map_product" />
<style>
    .imgDelete {
        background: rgba(153, 153, 153, 0.7) none repeat scroll 0 0;
        border-radius: 50%;
        color: #fff !important;
        cursor: pointer;
        display: block;
        height: 22px;
        line-height: 22px;
        position: absolute;
        right: -10px;
        text-align: center;
        top: -10px;
        width: 22px;
    }

    .layui-upload-img {
        width: 120px;
        height: 120px;
        margin: 0 10px 10px 0;
        border: 0 none;
        box-sizing: border-box;
        vertical-align: middle;
    }

    .img_div {
        background: #fff none repeat scroll 0 0;
        border: 1px solid #ddd;
        float: left;
        margin: 20px 25px 0 0;
        width: 120px;
        height: 120px;
        padding: 4px;
        position: relative;
    }
</style>
<style>
    /*控制文本框长度*/
</style>
<div class="title_ding">

    <p id="location">
        当前位置：
        修改商品
    </p>
</div>
<div class="layui">
    <div class="shopmain">
        <div class="layui-card">
            <div class="layui-card-header">修改商品</div>
            <div class="layui-card-body">
                <div class="layui-form" action="">
                    <div class="layui-form-item">
                        <label for="ProductName" class="layui-form-label">
                            商品名称
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="ProductName" name="ProductName" lay-verify="required" class="layui-input" value="@Model.ProductName" placeholder="请输入商品名称">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="Brand" class="layui-form-label">
                            品牌名称
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="Brand" name="Brand" value="@Model.Brand" class="layui-input" placeholder="请输入品牌名称,选填">
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <label for="Title" class="layui-form-label">
                            商品简介
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="Title" name="Title" lay-verify="required" class="layui-input" value="@Model.Title" placeholder="请输入商品简介,15个字内">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="ShipTemplateId" class="layui-form-label">
                            运费模板
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <select name="ShipTemplateId" id="ShipTemplateId">
                                <option value="">请选择</option>
                                @foreach (var item in ships)
                                {
                                    if (item.Id == Model.ShipTemplateId)
                                    {
                                        <option selected="selected" value="@item.Id">@item.ShippingTemplatesName</option>
                                    }
                                    else
                                    {
                                        <option value="@item.Id">@item.ShippingTemplatesName</option>
                                    }

                                }
                            </select>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red" ><a style="color: blue;" href="/Set/ShippingTemplateList">去设置模板</a></span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="text_paymentId" class="layui-form-label">
                            商品分类
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <select name="MenuId" id="MenuId">
                                <option value="">请选择</option>
                                @foreach (var item in menuList)
                                {
                                    if (item.Id == Model.MenuId)
                                    {
                                        <option selected="selected" value="@item.Id">@item.MenuName</option>
                                    }
                                    else
                                    {
                                        <option value="@item.Id">@item.MenuName</option>
                                    }

                                }
                            </select>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="Unit" class="layui-form-label">
                            商品单位
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="Unit" name="Unit" lay-verify="required" class="layui-input" value="@Model.Unit" placeholder="请输入单位,如'个','盒'等等">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="Sorft" class="layui-form-label">
                            商品排序
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="Sorft" name="Sorft" value="50" lay-verify="required" class="layui-input" value="@Model.Sorft" placeholder="请输入商品排序,越小越在前">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="InitSallNum" class="layui-form-label">
                            初始销量
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="InitSallNum" value="@Model.InitSallNum" name="InitSallNum" class="layui-input" placeholder="请输入初始销量,默认0,选填">
                        </div>

                    </div>
                    <div class="layui-form-item">
                        <label for="IsHot" class="layui-form-label">
                            是否热门
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            @if (Model.IsHot == 1)
                            {
                                <input type="checkbox" lay-filter="IsHot" name="IsHot" title="热门" lay-skin="primary" checked>
                            }
                            else
                            {
                                <input type="checkbox" lay-filter="IsHot" name="IsHot" title="热门" lay-skin="primary">
                            }
                                
                             
                            
                        </div>

                    </div>


                    <div class="layui-form-item">
                        <label for="text_servicephone" class="layui-form-label">
                            商品图片
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <button type="button" class="layui-btn" id="btn_upload">
                                <i class="layui-icon">&#xe67c;</i>上传图片
                            </button>

                            <div class="layui-upload-list">
                                @foreach (var item in Model.BannerImgs)
                                {
                                    <div class="img_div">
                                        <img class="layui-upload-img" src="@item"><i class="layui-icon layui-icon-close-fill imgDelete"></i>
                                    </div>
                                }

                            </div>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="text_servicephone" class="layui-form-label">

                        </label>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*建议450*450大小，图片建议100K以内,超过100K程序会自动压缩.(商品图最多5张)</span>
                        </div>


                    </div>

                    <div class="layui-form-item">
                        <label for="InitSallNum" class="layui-form-label">
                            商品详情
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <textarea id="productDetail" style="display: none;">@Model.Detail</textarea>
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>

                    </div>

                    <div class="layui-form-item" style="text-align:center;">
                        <div class="layui-input-block" style="margin:0;">
                            <button class="layui-btn" lay-submit lay-filter="add" Pid="@Model.Id">提交</button>
                            <button type="reset" id="btnBack" class="layui-btn">返回</button>
                        </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
</div>
<input type="hidden" id="hidden_ishot" value="@Model.IsHot"/>
<script src="~/scripts/Product/ProductEdit.js?v=1"></script>
<script>

    ProductEditClass.Instance.Init();
</script>